package com.itheima.api.generic.demo01;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class GenericDemo01 {

    public static void main(String[] args) {

//        Collection collection = new ArrayList();
        Collection<String> collection = new ArrayList<>();

        collection.add("hello");
        collection.add("world");
        collection.add("java");
//        这是integer引用数据类型
//        collection.add(23);

//        collection.forEach((Object obj) -> {
//            System.out.println(obj);
//        });

        Iterator<String> iterator = collection.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            System.out.println(s.length());
        }
    }
}
